# NUMTK
#
# Building by using BMake
#
# $ NUMTK: Makefile    Rev. 0.0.1    2013-11-05T21:02+08:00 $

.include <../../Makefile.mk>

CFLAGS= -O2 -Wall

## DO NOT COMMENT OUT THE FOLLOW BELOW LINE ##
CFLAGS+= ${CONFIGURE_ARGS}
## DO NOT COMMENT OUT THE FOLLOW ABOVE LINE ##

STATIC_OBJS= libnumtk.a
SHARED_OBJS= libnumtk.so

EXEC_OBJS= bin_numtk_v

BUILD_OBJS= ${STATIC_OBJS}

.ifndef WITHOUT_SHARED
BUILD_OBJS+= ${SHARED_OBJS}
.endif


# Build Library
build: ${BUILD_OBJS} ${EXEC_OBJS}


dblbk.o: dblbk.c
	${STDCC} -fpic -c dblbk.c ${CFLAGS} -I./ -I../base

fltbk.o: fltbk.c
	${STDCC} -fpic -c fltbk.c ${CFLAGS} -I./ -I../base


libnumtk.a: dblbk.o fltbk.o
	${AR} libnumtk.a dblbk.o fltbk.o
	${RANLIB} libnumtk.a

libnumtk.so: dblbk.o fltbk.o
	${LD} -shared -soname libnumtk.so -o libnumtk.so.0 \
	-lc dblbk.o fltbk.o
	${LN} ./libnumtk.so.0 libnumtk.so


# Validation Test
bin_numtk_v: validate_numtk.o
	${STDCC} -o bin_numtk_v validate_numtk.o libnumtk.a

validate_numtk.o: validate_numtk.c
	${STDCC} -c validate_numtk.c ${CFLAGS} -I./ -I../base


# Clean All Object Files
clean:
	${RM} *.o
	${RM} *.a
	${RM} *.so
	${RM} *.so.0
	${RM} ${EXEC_OBJS}
